/*

WSGEN:

frans@frans-Aspire-8950G:~/tmp/onixsoap/onixsoap/onixsoap$ 

wsgen -verbose -wsdl -keep -cp ./war/WEB-INF/classes/ -d /tmp/ws/ nl.boektrust.btsoep.server.PersistentServiceSoap

wsgen -verbose -wsdl -keep -cp ./war/WEB-INF/classes/:/home/frans/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/com.google.appengine.eclipse.sdkbundle_1.6.1.v201201120043r37/appengine-java-sdk-1.6.1/lib/user/orm/jdo2-api-2.3-eb.jar:/home/frans/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201201120043-rel-r37/gwt-2.4.0/gwt-user.jar -d /tmp/ws/ nl.boektrust.btsoep.server.PersistentServiceSoap

wsgen -verbose -wsdl -keep -cp ./war/WEB-INF/classes/:./war/WEB-INF/lib/objectify-3.0.jar:/home/frans/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/com.google.appengine.eclipse.sdkbundle_1.6.1.v201201120043r37/appengine-java-sdk-1.6.1/lib/user/orm/jdo2-api-2.3-eb.jar:/home/frans/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201201120043-rel-r37/gwt-2.4.0/gwt-user.jar -d /tmp/ws/ nl.boektrust.btsoep.server.PersistentServiceSoap

wsgen -verbose -wsdl -keep -cp ./war/WEB-INF/classes/:./war/WEB-INF/lib/objectify-3.0.jar:/home/frans/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/com.google.appengine.eclipse.sdkbundle_1.6.1.v201201120043r37/appengine-java-sdk-1.6.1/lib/user/orm/jdo2-api-2.3-eb.jar:/home/frans/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201201120043-rel-r37/gwt-2.4.0/gwt-user.jar:/home/frans/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201201120043-rel-r37/gwt-2.4.0/gwt-dev.jar -d /tmp/ws/ nl.boektrust.btsoep.server.PersistentServiceSoap


rm -rf src/nl/boektrust/btsoep/server/jaxws
mkdir src/nl/boektrust/btsoep/server/jaxws
cp -t src/nl/boektrust/btsoep/server/jaxws/ /tmp/ws/nl/boektrust/btsoep/server/jaxws/*.java
cp -t src/nl/boektrust/btsoep/server/jaxws/ /tmp/ws/*s*

DEMO WSIMPORT:

cd temp...

wsimport -p nl.boektrust.btsoep.wsimport.PersistentService -Xnocompile -keep http://127.0.0.1:8888/BrowseSoapServlet/nl/boektrust/btsoep/server/jaxws/PersistentServiceSoapService.wsdl

cp ....

see war/PersistentService.jsp

 */

package nl.boektrust.btsoep.server;

import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebService;

import nl.boektrust.btsoep.shared.model.ImageReferenceTypeCode;
import nl.boektrust.btsoep.shared.model.Person;
import nl.boektrust.btsoep.shared.model.PhysicalBookManifestation;

import com.googlecode.objectify.Key;

/**
 * Clone of {@link nl.boektrust.btsoep.client.PersistentService} but without
 * using {@link com.googlecode.objectify.Key}.
 * 
 * @author frans
 * 
 */
interface PS {

	void persistBTEntity(String name, String url)
			throws IllegalArgumentException;

	// Key<Person> persistPerson(Person person) throws IllegalArgumentException;

	void deletePerson(Person person) throws IllegalArgumentException;

	List<Person> getAllPersons() throws IllegalArgumentException;

	void persistPhysicalBookManifestation(PhysicalBookManifestation bookmf)
			throws IllegalArgumentException;

	List<PhysicalBookManifestation> getAllPhysicalBookManifestations()
			throws IllegalArgumentException;

	void deletePhysicalBookManifestation(PhysicalBookManifestation book)
			throws IllegalArgumentException;

	int getNumberOfAssets(ImageReferenceTypeCode imageReferenceType)
			throws IllegalArgumentException;

	List<PhysicalBookManifestation> getBooksByISBN(String isbn)
			throws IllegalArgumentException;

	int getNumberOfEntities() throws IllegalArgumentException;

	int getNumberOfPhysicalBooks() throws IllegalArgumentException;

	List<PhysicalBookManifestation> getBooksForPerson(Person p)
			throws IllegalArgumentException;

	List<Person> getPersonsByPartialName(String name)
			throws IllegalArgumentException;

}

/**
 * Clone/wrapper of {@link PersistentServiceImpl}, but because of its
 * dependencies it can not be used. Implements
 * {@link nl.boektrust.btsoep.client.PersistentService} but excluding
 * {@link #persistPerson(Person)} as webmethod because of the
 * {@link com.googlecode.objectify.Key}
 * 
 * @author frans
 * 
 */
@WebService
public class PersistentServiceSoap implements
		nl.boektrust.btsoep.client.PersistentService {
	private PersistentServiceImpl psi;

	/**
	 * Must have default constructor for wsgen.
	 */
	public PersistentServiceSoap() {
		this.psi = null;
	}

	/**
	 * Getter/setter for wrapper contents {@link PersistentServiceImpl}. Must be
	 * excluded from WS because type is too complex.
	 * 
	 * @return
	 */
	@WebMethod(exclude = true)
	public PersistentServiceImpl getPsi() {
		return psi;
	}

	/**
	 * Getter/setter for wrapper contents {@link PersistentServiceImpl}. Must be
	 * excluded from WS because type is too complex.
	 * 
	 * @return
	 */
	@WebMethod(exclude = true)
	public void setPsi(PersistentServiceImpl psi) {
		this.psi = psi;
	}

	@Override
	public void persistBTEntity(String name, String url)
			throws IllegalArgumentException {
		psi.persistBTEntity(name, url);

	}

	/**
	 * The return type {@link com.googlecode.objectify.Key} crashes wsgen.
	 */
	@WebMethod(exclude = true)
	@Override
	public Key<Person> persistPerson(Person person)
			throws IllegalArgumentException {
		return psi.persistPerson(person);
	}

	@Override
	public void deletePerson(Person person) throws IllegalArgumentException {
		psi.deletePerson(person);
	}

	@Override
	public List<Person> getAllPersons() throws IllegalArgumentException {
		return psi.getAllPersons();
	}

	@Override
	public void persistPhysicalBookManifestation(
			PhysicalBookManifestation bookmf) throws IllegalArgumentException {
		psi.persistPhysicalBookManifestation(bookmf);
	}

	@Override
	public List<PhysicalBookManifestation> getAllPhysicalBookManifestations()
			throws IllegalArgumentException {
		return psi.getAllPhysicalBookManifestations();
	}

	@Override
	public void deletePhysicalBookManifestation(PhysicalBookManifestation book)
			throws IllegalArgumentException {
		psi.deletePhysicalBookManifestation(book);
	}

	@Override
	public int getNumberOfAssets(ImageReferenceTypeCode imageReferenceType)
			throws IllegalArgumentException {
		return psi.getNumberOfAssets(imageReferenceType);
	}

	@Override
	public List<PhysicalBookManifestation> getBooksByISBN(String isbn)
			throws IllegalArgumentException {
		return psi.getBooksByISBN(isbn);
	}

	@Override
	public int getNumberOfEntities() throws IllegalArgumentException {
		return psi.getNumberOfEntities();
	}

	@Override
	public int getNumberOfPhysicalBooks() throws IllegalArgumentException {
		return psi.getNumberOfPhysicalBooks();
	}

	@Override
	public List<PhysicalBookManifestation> getBooksForPerson(Person p)
			throws IllegalArgumentException {
		return psi.getBooksForPerson(p);
	}

	@Override
	public List<Person> getPersonsByPartialName(String name)
			throws IllegalArgumentException {
		return psi.getPersonsByPartialName(name);
	}

	@Override
	public String getUploadURL(String path) throws IllegalArgumentException {
		return psi.getUploadURL(path);
	}

}
